Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

started work on adding discrete inputs and coils working. #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

winnme
Copy link

@winnme winnme commented May 10, 2024

  • added additional tables
  • added relevant pymodbus code to _scan_value_range
  • modified return statement to differentiate between analogue and digital result-objects

- added additional tables
- added relevant pymodbus code to _scan_value_range
- modified return statement to differentiate between analogue and digital result-objects
Copy link

@r-xyz r-xyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I would suggest to stick with more explicit nomenclature:

di -> discrete_input
do -> coils

Also i think method read_do does not exist.

Please let me know if you are willing to improve it, otherwise I can submit another PR; since I am also interested in merging new feature.

@@ -226,11 +226,18 @@ def _scan_value_range(self, table, start, count):
result = self._mb.read_input_registers(start, count, unit=self._unit)
elif table == 'holding':
result = self._mb.read_holding_registers(start, count, unit=self._unit)
elif table == 'do':
result = self._mb.read_do(start, count, unit=self._unit)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read_do do not exists, you would like to call read_coils instead.
PyModBus docs

image

@@ -50,10 +50,10 @@ def __init__(self,
self._port = port
# This is a dict of sets. Each key represents one table of modbus registers.
# At the moment it has 'input' and 'holding'
self._tables = {'input': set(), 'holding': set()}
self._tables = {'input': set(), 'holding': set(), 'do': set(), 'di': set()}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve table names


# This is a dicts of dicts. These hold the current values of the interesting registers
self._values = {'input': {}, 'holding': {}}
self._values = {'input': {}, 'holding': {}, 'do': {}, 'di': {}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I would suggest to stick with more explicit nomenclature:

di -> discrete_input
do -> coils

Also i think method read_do does not exist.

Please let me know if you are willing to improve it, otherwise I can submit another PR; since I am also interested in merging new feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants